package com.czf.company.controller;

import com.czf.common.util.AjaxResult;
import com.czf.company.service.BankInfoServiceImpl;
import com.czf.company.service.CompanyScoreServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zfChen
 * @create 2022/4/25 9:42
 */
@RestController
@CrossOrigin
@Slf4j
@RequestMapping("/company")
public class CompanyScoreController {

    @Autowired
    private CompanyScoreServiceImpl companyScoreService;
    @Autowired
    private BankInfoServiceImpl bankInfoService;


    @RequestMapping(value = "getScore",method = RequestMethod.GET)
    public AjaxResult getCompanyInfoScore(Long userId) {
        float companyScore = companyScoreService.getCompanyScore(userId);
        int bankScore = bankInfoService.getBankScore(userId);
        float company = companyScore * 2 / 300;
        float bank = (float)bankScore / 300;
        return AjaxResult.success(company+bank);
    }


}
